#include <stdio.h>
#include <stdlib.h>
#include "include/libabs-appfwk.h"
Evas_Object* libabs_appfwk_init(){
	edje_init();
	ecore_evas_init();

}
Evas_Object* libabs_appfwk_start_loop(){
	elm_run();

}
Evas_Object* libabs_appfwk_stop_loop(){
	elm_exit();

}
Evas_Object* libabs_appfwk_quit(){
	elm_shutdown();

}

Evas_Object* libabs_appfwk_get_main_window(const char* name){
	Evas_Object* win_main;
	win_main = elm_win_add(NULL, name, ELM_WIN_BASIC);
	return win_main;
}
Evas_Object* libabs_appfwk_load_edj(Evas_Object* win_obj, const char* filepath, const char* groupname){
	Evas_Object* ret;
	int w, h;

	ret=elm_layout_add(win_obj);
	elm_layout_file_set(ret, filepath, groupname);
	evas_object_move(ret, 0, 0);
	elm_win_resize_object_add(win_obj, ret);
	evas_object_show(ret);
	return ret;

}

void libabs_appfwk_debug_evas_object_geometry(Evas_Object* obj){
	int x,y,w,h;
	evas_object_geometry_get(obj, &x, &y, &w, &h);
	printf("size : x %d y %d w %d h %d\n", x, y, w, h);
}

void libabs_appfwk_debug_layout_geometry(Evas_Object* layout, const char* part){
	int x,y,w,h;

	edje_object_part_geometry_get(layout, part, &x, &y, &w, &h);
	printf("x %d y %d w %d h %d\n", x, y, w, h);
}

